fix(#1): catch Slack API rejections in turn-handler - #1
Conversation
Jackallink
left a comment
There was a problem hiding this comment.
Independent review (fresh-context pass) — 2026-09-04
Acting as a reviewer without author context. Going through each PR for AGENTS.md compliance and missed siblings.
Findings on PR #1
1. Missed sibling: client.chat.update on line 283 of same file
The diff fixes reactions.add / reactions.remove / chat.delete, but the same file has:
update: (ts, text, blocks) =>
client.chat.update({ channel: inc.channel, ts, text, blocks, ...botIdentityArgs() }).then(() => {
mirrorSelfPost(inc.channel, ts, text, { sub: replyThreadTs, editedAt: Date.now() });
}),client.chat.update is the same Slack API fire-and-forget pattern as chat.delete, but the chain ends at .then(() => { mirrorSelfPost(...) }) and the mirror call IS executed on success — the mirror is in-process so its failure won't crash the process, but the client.chat.update rejection itself will still trigger an unhandledRejection.
This is the exact same bug class as #1, in the same file, untouched. AGENTS.md "Fix every instance" rule: grep the file/area for the same pattern, fix all of it.
2. Comment about .catch(() => undefined) is silent swallowing
Three rejection paths now swallow errors with no log line. If Slack rate-limits a reaction the bot silently drops the reaction forever and the operator has no signal. Compare with yc-software#9's pattern where the fallback catches include a console.error. Consider whether these reaction/delete paths warrant a similar diagnostic log so post-mortem can see "reaction X was rejected" — at minimum during NODE_ENV !== 'production' or behind a debug flag.
3. Test coverage: only test/slack-reactions.test.ts touched
The PR body claims 47/47 affected tests pass. Verify test/slack-reactions.test.ts actually exercises the reaction reject path, not just the encoding helpers (saw "decodeTs rejects a malformed id" — that's the unit test for an encoding helper, not the rejection path). If reaction.reject isn't asserted, the bug class is unverified by tests.
4. AGENTS.md discipline check
- ✅
--repoon every gh call (verified) - ✅ No upstream issue number (Refs only
Jackallink/qm-integration#1) - ✅ 0 new comments
⚠️ Affected test claim vs coverage scope (item 3)⚠️ "Fix every instance" incomplete (item 1)
Not blocking but #1 should be addressed before merge — either widen the diff to line 283 or open a sibling issue for it (consistent with how yc-software#13 yc-software#14 were opened for cross-package audit-v5 patterns).
|
Independent review (fresh-context pass) — 2026-09-04 Acting as a reviewer without author context. Going through each PR for AGENTS.md compliance and missed siblings. Findings on PR #11. Missed sibling:
|
|
Deep-review pass addendum — 2026-09-04 (second, adversarial pass; first pass findings still stand) Verified on branch
F1.2 (silent swallow) confirmed, though |
reactions.add / reactions.remove / chat.delete / chat.update at src/slack/turn-handler.ts were fired without a .catch handler. When Slack rejects (rate limit, 5xx, expired token), the derived promise becomes an unhandledRejection and Node terminates the process by default, dropping the bot offline. Wrap each call with .catch(() => undefined) so reaction/list-management failures stay isolated to the turn path and align with how deliveries.ts handles Slack API errors elsewhere in the same package. Refs: Jackallink/qm-integration#1
93d9910 to
b768d01
Compare
|
Amended — 2026-09-04 (addresses deep-review F1.1)
F1.2 (silent swallow, no log) intentionally left as v6 polish to match repo convention. |
Closes: Jackallink/qm-integration#1
reactions.add/reactions.remove/chat.deleteat src/slack/turn-handler.ts:269,271,288 were fired via .then(() => {}) without a .catch handler. When Slack rejects (rate limit, 5xx, expired token), the derived promise becomes an unhandledRejection and Node terminates the process by default, dropping the bot offline.Wrap each call with .catch(() => undefined) so reaction/list-management failures stay isolated to the turn path and align with how deliveries.ts handles Slack API errors elsewhere in the same package.
Affected tests
Reviewer checklist